class RegisterValue{
    RegisterValue(){
        this.addrType = 0;
    }

    doGetValue(addr, len){
        if(addr < 0x100000000){
            return form("0x%x", addr);
        }

        if(Byte(addr) == 0xffffffffffff){
            return "";
        }

        auto comment, name;
        comment = CommentEx(addr, 1);
        name = Name(addr);

        auto i, firstTmpValue, tmpValue, addrType;
        auto result = "";
        if(this.addrType == 1){
            firstTmpValue1111 = Byte(addr）;
            for(i = 1; i < len; i++){
                tmpValue = Byte(addr + i);
                if((tmpValue >= 0x41 && tmpValue <= 0x5A) || (tmpValue >= 0x61 && tmpValue <= 0x7A) || (tmpValue >= 0x30 && tmpValue <= 0x39) || tmpValue == 0x3A){
                    result = form("%s%s", result, tmpValue);
                    continue;
                }

                this.addrType == 0;
                if(comment == ""){
                    return result;
                }
                return result + "  ; " + comment;
            }
        }

        for(i = 0; i < len; i++){
            tmpValue = Byte(addr + i);
            // if(tmpValue < 0x00 || tmpValue > 0x7F){
            //     break;
            // }
            result = form("%s%s", result, tmpValue);
        }

        if(comment == ""){
            return result;
        }
        return result + "  ; " + comment;
    }

    getValue(registerType, len){
        auto addr, e;
        try{
            if(registerType == 0 || registerType == "X0" || registerType == "W0"){
                addr = x0;
                //Message("x0 : 0x%x\n", tmp);
                return this.doGetValue(addr, len);
            } else if(registerType == 1 || registerType == "X1" || registerType == "W1"){
                addr = x1;
                return this.doGetValue(addr, len);
            } else if(registerType == 2 || registerType == "X2" || registerType == "W2"){
                addr = x2;
                return this.doGetValue(addr, len);
            } else if(registerType == 3 || registerType == "X3" || registerType == "W3"){
                addr = x3;
                return this.doGetValue(addr, len);
            } else if(registerType == 4 || registerType == "X4" || registerType == "W4"){
                addr = x4;
                return this.doGetValue(addr, len);
            } else if(registerType == 5 || registerType == "X5" || registerType == "W5"){
                addr = x5;
                return this.doGetValue(addr, len);
            } else if(registerType == 6 || registerType == "X6" || registerType == "W6"){
                addr = x6;
                return this.doGetValue(addr, len);
            } else if(registerType == 7 || registerType == "X7" || registerType == "W7"){
                addr = x7;
                return this.doGetValue(addr, len);
            } else if(registerType == 8 || registerType == "X8" || registerType == "W8"){
                addr = x8;
                return this.doGetValue(addr, len);
            } else if(registerType == 9 || registerType == "X9" || registerType == "W9"){
                addr = x9;
                return this.doGetValue(addr, len);
            } else if(registerType == 10 || registerType == "X10" || registerType == "W10"){
                addr = x10;
                return this.doGetValue(addr, len);
            } else if(registerType == 11 || registerType == "X11" || registerType == "W11"){
                addr = x11;
                return this.doGetValue(addr, len);
            } else if(registerType == 12 || registerType == "X12" || registerType == "W12"){
                addr = x12;
                return this.doGetValue(addr, len);
            } else if(registerType == 13 || registerType == "X13" || registerType == "W13"){
                addr = x13;
                return this.doGetValue(addr, len);
            } else if(registerType == 14 || registerType == "X14" || registerType == "W14"){
                addr = x14;
                return this.doGetValue(addr, len);
            } else if(registerType == 15 || registerType == "X15" || registerType == "W15"){
                addr = x15;
                return this.doGetValue(addr, len);
            } else if(registerType == 16 || registerType == "X16" || registerType == "W16"){
                addr = x16;
                return this.doGetValue(addr, len);
            } else if(registerType == 17 || registerType == "X17" || registerType == "W17"){
                addr = x17;
                return this.doGetValue(addr, len);
            } else if(registerType == 18 || registerType == "X18" || registerType == "W18"){
                addr = x18;
                return this.doGetValue(addr, len);
            } else if(registerType == 19 || registerType == "X19" || registerType == "W19"){
                addr = x19;
                return this.doGetValue(addr, len);
            } else if(registerType == 20 || registerType == "X20" || registerType == "W20"){
                addr = x20;
                return this.doGetValue(addr, len);
            } else if(registerType == 21 || registerType == "X21" || registerType == "W21"){
                addr = x21;
                return this.doGetValue(addr, len);
            } else if(registerType == 22 || registerType == "X22" || registerType == "W22"){
                addr = x22;
                return this.doGetValue(addr, len);
            } else if(registerType == 23 || registerType == "X23" || registerType == "W23"){
                addr = x23;
                return this.doGetValue(addr, len);
            } else if(registerType == 24 || registerType == "X24" || registerType == "W24"){
                addr = x24;
                return this.doGetValue(addr, len);
            } else if(registerType == 25 || registerType == "X25" || registerType == "W25"){
                addr = x25;
                return this.doGetValue(addr, len);
            } else if(registerType == 26 || registerType == "X26" || registerType == "W26"){
                addr = x26;
                return this.doGetValue(addr, len);
            } else if(registerType == 27 || registerType == "X27" || registerType == "W27"){
                addr = x27;
                return this.doGetValue(addr, len);
            } else if(registerType == 28 || registerType == "X28" || registerType == "W28"){
                addr = x28;
                return this.doGetValue(addr, len);
            } else if(registerType == 29 || registerType == "X29" || registerType == "W29"){
                addr = x29;
                return this.doGetValue(addr, len);
            } else if(registerType == 30 || registerType == "X30" || registerType == "W30"){
                addr = x30;
                return this.doGetValue(addr, len);
            } else if(registerType == 31 || registerType == "SP"){
                addr = sp;
                return this.doGetValue(addr, len);
            } else if(registerType == 32 || registerType == "PC"){
                addr = pc;
                return this.doGetValue(addr, len);
            } else if(registerType == 33 || registerType == "PSR"){
                addr = psr;
                return this.doGetValue(addr, len);
            }
        } catch(e) {
            Message("get register value exception, addr: %s\n", addr);
        }
        return "";
    }

    getAddr(registerType){
        auto addr, e;
        try{
            if(registerType == 0 || registerType == "X0" || registerType == "W0"){
                addr = x0;
                return addr;
            } else if(registerType == 1 || registerType == "X1" || registerType == "W1"){
                addr = x1;
                return addr;
            } else if(registerType == 2 || registerType == "X2" || registerType == "W2"){
                addr = x2;
                return addr;
            } else if(registerType == 3 || registerType == "X3" || registerType == "W3"){
                addr = x3;
                return addr;
            } else if(registerType == 4 || registerType == "X4" || registerType == "W4"){
                addr = x4;
                return addr;
            } else if(registerType == 5 || registerType == "X5" || registerType == "W5"){
                addr = x5;
                return addr;
            } else if(registerType == 6 || registerType == "X6" || registerType == "W6"){
                addr = x6;
                return addr;
            } else if(registerType == 7 || registerType == "X7" || registerType == "W7"){
                addr = x7;
                return addr;
            } else if(registerType == 8 || registerType == "X8" || registerType == "W8"){
                addr = x8;
                return addr;
            } else if(registerType == 9 || registerType == "X9" || registerType == "W9"){
                addr = x9;
                return addr;
            } else if(registerType == 10 || registerType == "X10" || registerType == "W10"){
                addr = x10;
                return addr;
            } else if(registerType == 11 || registerType == "X11" || registerType == "W11"){
                addr = x11;
                return addr;
            } else if(registerType == 12 || registerType == "X12" || registerType == "W12"){
                addr = x12;
                return addr;
            } else if(registerType == 13 || registerType == "X13" || registerType == "W13"){
                addr = x13;
                return addr;
            } else if(registerType == 14 || registerType == "X14" || registerType == "W14"){
                addr = x14;
                return addr;
            } else if(registerType == 15 || registerType == "X15" || registerType == "W15"){
                addr = x15;
                return addr;
            } else if(registerType == 16 || registerType == "X16" || registerType == "W16"){
                addr = x16;
                return addr;
            } else if(registerType == 17 || registerType == "X17" || registerType == "W17"){
                addr = x17;
                return addr;
            } else if(registerType == 18 || registerType == "X18" || registerType == "W18"){
                addr = x18;
                return addr;
            } else if(registerType == 19 || registerType == "X19" || registerType == "W19"){
                addr = x19;
                return addr;
            } else if(registerType == 20 || registerType == "X20" || registerType == "W20"){
                addr = x20;
                return addr;
            } else if(registerType == 21 || registerType == "X21" || registerType == "W21"){
                addr = x21;
                return addr;
            } else if(registerType == 22 || registerType == "X22" || registerType == "W22"){
                addr = x22;
                return addr;
            } else if(registerType == 23 || registerType == "X23" || registerType == "W23"){
                addr = x23;
                return addr;
            } else if(registerType == 24 || registerType == "X24" || registerType == "W24"){
                addr = x24;
                return addr;
            } else if(registerType == 25 || registerType == "X25" || registerType == "W25"){
                addr = x25;
                return addr;
            } else if(registerType == 26 || registerType == "X26" || registerType == "W26"){
                addr = x26;
                return addr;
            } else if(registerType == 27 || registerType == "X27" || registerType == "W27"){
                addr = x27;
                return addr;
            } else if(registerType == 28 || registerType == "X28" || registerType == "W28"){
                addr = x28;
                return addr;
            } else if(registerType == 29 || registerType == "X29" || registerType == "W29"){
                addr = x29;
                return addr;
            } else if(registerType == 30 || registerType == "X30" || registerType == "W30"){
                addr = x30;
                return addr;
            } else if(registerType == 31 || registerType == "SP"){
                addr = sp;
                return addr;
            } else if(registerType == 32 || registerType == "PC"){
                addr = pc;
                return addr;
            } else if(registerType == 33 || registerType == "PSR"){
                addr = psr;
                return addr;
            }
        } catch(e) {
            Message("get register addr exception, addr: %s\n", addr);
        }
        return -1;
    }
}